﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace IllustratedCsharp7_ch20_Linq
{
    class chapt20_5_5OrderbyClause
    {
        static void _Main()
        {
            var students = new[] //匿名类型的对象数组
            {
                    new { LName="Jones",    FName="Mary",   Age=19,Major="History" },
                    new { LName="Smith",    FName="Bob",    Age=20,Major="CompSci" },
                    new { LName="Fleming",  FName="cAROL",  Age=21,Major="History" }
            };

            var query = from student in students
                        orderby student.Age descending
                        select student;

            foreach (var s in query)
                Console.WriteLine($"{s.LName},{s.FName}: {s.Age},{s.Major}");
        }
    }
}
